package cn.itsource.autoconfigure;


import cn.itsource.config.MybatisPlusConfig;
import cn.itsource.config.RedisConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.web.client.RestTemplate;

//微信的自动配置类,把：获取OpenId,获取AccessToken,获取手机号的代码抽到Starter中
//标记配置类
@Configuration(proxyBeanMethods = false)
//导入Import
@Import({MybatisPlusConfig.class, RedisConfig.class})
@Slf4j
public class BasicAutoConfigure {
    @Bean
    //当不存在这个Bean的时候再创建，防止重复创建
    @ConditionalOnMissingBean(RestTemplate.class)
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }
}
